<template>
  <div id="app">
    <router-view :depSelArray="depSelArray" :userDepCode="userDepCode"/>
  </div>
</template>
<script>
import { mapState } from 'vuex'
import Sever from '@/api/selfApi'
export default {
  name: 'App',
  data() {
    return {
      baseUrl: process.env.BASE_URL,
      depSelArray: [],
      userDepCode: ''
    }
  },
  computed: {
    ...mapState({
      getBackData: ({ login }) => login.getLoginData
    }),
    env() {
      return process.env.VUE_APP_SERVICE_CONFIG
    }
  },
  mounted() {
    this.initData()
    // console.log(process.env.VUE_APP_SERVICE_CONFIG, '=====')
  },
  methods: {
    async initData() {
      //请求后台返回数据
      try {
        //请求后台接口
        const res = await Sever.map.getChooseDep({})
        console.log(res)

        res.forEach((element) => {
          this.depSelArray.push({
            value: element.DEP_CODE,
            label: element.DEP_NAME
          })
        })
        this.userDepCode = res[0].DEP_CODE
      } catch (error) {
        console.log(error)
      }
    }
  }
}
</script>

<style lang="scss">
// 全局样式文件
#app {
  width: 100%;
  height: 100%;
}
</style>
